<?php

namespace app\api\model;

use think\Model;
use traits\model\SoftDelete;

class Refunds extends Model
{
    use SoftDelete;
    protected $autoWriteTimestamp = 'int';
    protected $deleteTime = "deletetime";
    protected $createTime = "createtime";
    protected $updateTime = "updatetime";

    public function getUpdatetimeAttr($value)
    {
        return $value ? date('Y-m-d H:i:s', $value) : '';
    }

    public static function getRefundByOrderId($order_id)
    {
        return self::where('order_id', $order_id)->where('status', 1)->find();
    }
}
